#ifndef TouchCore_h
#define TouchCore_h

#define MAX_TOUCH_OPTION 20

struct AttributionButton
{
	int x, y, w, h, anchor;  //anchor: TOP, LEFT, RIGHT, BOTTOM
};

class TouchCore
{

private:	
	int iNumOfOption; //number of button when be added
	int iCurrentHoverButton;
	bool isTouchReleased;
	AttributionButton m_Menu[MAX_TOUCH_OPTION]; //array of button when be added

	static TouchCore* touchCore;

public:

	static short s_MenuSelection;
	static short s_MenuSelectionReleased;
	
	TouchCore();
    virtual ~TouchCore();  

	static TouchCore* GetTouch();

	//Select option when focus
	void OnFocusOption(int index);

	bool IsTouchReleased();
	
	//Get current select option
	int GetCurrentMenuItemID(int index);

	//Lost focus option
	void OnLostFocusOption();

	//Release select option
	void OnReleaseOption(int index);

	//Reset menu when change state
	void MenuReset();

	//add option in menu
	void MenuAddOption(int x, int y, int w, int h);
	void MenuAddOption(int x, int y, int w, int h, int anchor);

	//update menu and return current select option (index)
	void MenuUpdate(int x, int y, int state);

	void MenuUpdate();

	//paint to debug touch
	void DebugTouch();

	//Touch screen
	//Touch on rectangle (x, y, width, height)
	bool IsTouchRectangle(int pointerX, int pointerY, int x, int y, int w, int h, int flag); 

	bool IsTouchRectangle(int pointerX, int pointerY, int x, int y, int w, int h); 

	//Touch on circle (x, y, radius)
	bool IsTouchCircle(int pointerX, int pointerY, int x, int y, int radius); 
		
	//Touch at pointer get angles 
	int GetAngles(int pointerX, int pointerY, int x, int y);




    
};
#endif